package com.wicket.okrframework.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrframework.biz.service.OffStateService;
import com.wicket.okrframework.biz.service.dto.req.*;
import com.wicket.okrframework.biz.service.dto.res.*;
import com.wicket.okrframework.common.ro.OkrResult;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/base/offState/")
public class OffStateController {

    @Autowired
    OffStateService offStateService;

    /**
     * D1-1修改状态校验项
     */
    @PostMapping("updateCheckItemStat")
    public OkrResult<UpdateCheckItemStatRespDto> updateCheckItemStat(@RequestBody @Validated UpdateCheckItemStatReqDto reqDTO) {
        return OkrResult.success(offStateService.updateCheckItemStat(reqDTO));
    }

    /**
     * D1-1查询状态校验项列表
     */
    @PostMapping("queryCheckItemStatList")
    public OkrResult<QueryCheckItemStatListRespDto> queryCheckItemStatList(@RequestBody @Validated QueryCheckItemStatListReqDto reqDTO) {
        Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(), reqDTO.getPageSize());

        QueryCheckItemStatListRespDto retData = offStateService.queryCheckItemStatList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);

    }

    /**
   * D1-1查询状态校验项详情
   */
    @PostMapping("queryCheckItemStatDetail")
    public OkrResult<QueryCheckItemStatDetailRespDto> queryCheckItemStatDetail(@RequestBody @Validated QueryCheckItemStatDetailReqDto reqDTO){
    return OkrResult.success(offStateService.queryCheckItemStatDetail(reqDTO));
    }
/**
   * D1-1修改检查项状态(公共)
   */
    @PostMapping("updateCheckItemStatCom")
    public OkrResult<UpdateCheckItemStatComRespDto> updateCheckItemStatCom(@RequestBody @Validated UpdateCheckItemStatComReqDto reqDTO){
    return OkrResult.success(offStateService.updateCheckItemStatCom(reqDTO));
    }

    /**
   * D1-3更新组织成员管理检查项等
   */
    @PostMapping("refreshOrgMemberMgtCheckEtc")
    public OkrResult<RefreshOrgMemberMgtCheckEtcRespDto> refreshOrgMemberMgtCheckEtc(@RequestBody @Validated RefreshOrgMemberMgtCheckEtcReqDto reqDTO){
    return OkrResult.success(offStateService.refreshOrgMemberMgtCheckEtc(reqDTO));
    }
}
